{extend name="../../admin/view/main"}
{block name="button"}
<!--{if auth("add")}-->
<button data-open='{:url("add")}' data-title="添加碎片" class='layui-btn layui-btn-sm layui-btn-primary'>添加碎片</button>
<!--{/if}-->
{/block}

{block name="content"}
<div class="layui-tab layui-tab-card think-bg-white">
    <div class="layui-tab-content think-box-shadow">
        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th class='text-left nowrap' width="120px">碎片名称</th>
                <th class='text-left nowrap' width="120px">碎片别名</th>
                <th class='text-left nowrap' width="120px">类型</th>
                <th class='text-left nowrap'>调用代码</th>
                <th class='text-left nowrap'>添加时间</th>
                <th>操作</th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr data-dbclick>
                <td class='text-left nowrap'>
                    {$vo.name}
                </td>
                <td class='text-left nowrap'>
                    {$vo.alias}
                </td>
                <td class='text-left nowrap'>
                    {:config('constant.blockType')[$vo.type]}
                </td>
                <td class='text-left nowrap'>
                    {$vo.code}
                </td>
                <td class='text-left nowrap'>
                    {$vo.create_at|format_datetime}
                </td>
                <td class='text-left nowrap'>
                    <!--{if auth("edit")}-->
                    <a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑碎片" data-open='{:url("edit",["id"=>$vo.id])}'>编 辑</a>
                    <!--{/if}-->
                    <!--{if auth("delete")}-->
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要永久删除此碎片吗？" data-action="{:url('delete')}" data-value="id#{$vo.id}" data-csrf="{:systoken('delete')}">删 除</a>
                    <!--{/if}-->
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>
{/block}
